Passed
Push — feature/improve-applicant-list ( 3fd796...cbd310 )
by Chris
04:06
created

lookupConstants.ts ➔ enumToIds   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
export const ClassificationId = {
2
  AS: 1,
3
  BI: 2,
4
  CO: 3,
5
  CR: 4,
6
  CS: 5,
7
  EC: 6,
8
  EX: 7,
9
  FO: 8,
10
  IS: 9,
11
  PC: 10,
12
  PE: 11,
13
  PM: 12,
14
  AD: 13,
15
  "EN-ENG": 14,
16
  FI: 15,
17
};
18
19
export enum ReviewStatusId {
20
  ScreenedOut = 1,
21
  StillThinking = 2,
22
  StillIn = 3,
23
}
24
25
export type ReviewStatusName = "screened_out" | "still_thinking" | "still_in";
26
27
export enum ResponseReviewStatusId {
28
  ScreenedOut = 1,
29
  ReadyForReference = 4,
30
  ReadyToAllocate = 5,
31
  AssessmentRequired = 6,
32
  Allocated = 7,
33
  NotAvailable = 8,
34
}
35
36
export type ResponseReviewStatusName =
37
  | "screened_out"
38
  | "ready_for_reference"
39
  | "ready_to_allocate"
40
  | "assessment_required"
41
  | "allocated"
42
  | "not_available";
43
44
export type ResponseReviewStatus = {
45
  id: ResponseReviewStatusId;
46
  name: ResponseReviewStatusName;
47
};
48
49
export enum ExcludedDepartments {
50
  StrategicTalentResponse = 18,
51
}
52
53
export enum CriteriaTypeId {
54
  Essential = 1,
55
  Asset = 2,
56
}
57
58
export enum SkillTypeId {
59
  Soft = 1,
60
  Hard = 2,
61
}
62
63
export enum SkillLevelId {
64
  Basic = 1,
65
  Intermediate = 2,
66
  Advanced = 3,
67
  Expert = 4,
68
}
69
70
export enum AssessmentTypeId {
71
  NarrativeAssessment = 1,
72
  ApplicationScreeningQuestion = 2,
73
  GroupTest = 3,
74
  InformalPhoneConversation = 4,
75
  Interview = 5,
76
  OnlineExam = 6,
77
  OnSiteExam = 7,
78
  TakeHomeExam = 8,
79
  PortfolioReview = 9,
80
  ReferenceCheck = 10,
81
  SeriousGames = 11,
82
}
83
84
export const ProvinceId = {
85
  AB: 1,
86
  BC: 2,
87
  MB: 3,
88
  NL: 4,
89
  NB: 5,
90
  NS: 6,
91
  NU: 7,
92
  NT: 8,
93
  ON: 9,
94
  PE: 10,
95
  QC: 11,
96
  SK: 12,
97
  YT: 13,
98
};
99
100
export const SecurityClearanceId = {
101
  reliability: 1,
102
  secret: 2,
103
  topSecret: 3,
104
};
105
106
export const LanguageRequirementId = {
107
  english: 1,
108
  french: 2,
109
  bilingualIntermediate: 3,
110
  bilingualAdvanced: 4,
111
  englishOrFrench: 5,
112
};
113
114
export const FrequencyId = {
115
  never: 1,
116
  rarely: 2,
117
  sometimes: 3,
118
  often: 4,
119
  always: 5,
120
};
121
122
export const TravelRequirementId = {
123
  frequently: 1,
124
  available: 2,
125
  none: 3,
126
};
127
128
export const OvertimeRequirementId = {
129
  frequently: 1,
130
  available: 2,
131
  none: 3,
132
};
133
134
export const CommentTypeId = {
135
  question: 1,
136
  recommendation: 2,
137
  requiredAction: 3,
138
};
139
140
export const LocationId = {
141
  jobGeneric: "job/generic",
142
  heading: "job/heading",
143
  basicInfo: "job/basicInfo",
144
  impact: "job/impact",
145
  tasks: "job/tasks",
146
  skills: "job/skills",
147
  langRequirements: "job/langRequirements",
148
  environment: "job/environment",
149
  summary: "hr/summary",
150
  preview: "hr/preview",
151
  screeningPlan: "screeningPlan/generic",
152
  screeningPlanBuilder: "screeningPlan/builder",
153
  screeningPlanSummary: "screeningPlan/summary",
154
  screeningPlanRatings: "screeningPlan/ratings",
155
  applicantsGeneric: "applicants/generic",
156
  underConsideration: "applicants/underConsideration",
157
  optionalConsideration: "applicants/optionalConsideration",
158
  notUnderConsideration: "applicants/notUnderConsideration",
159
} as const;
160
161
export enum JobStatus {
162
  Draft = "draft",
163
  ReviewManager = "review_manager",
164
  ReviewHr = "review_hr",
165
  Translation = "translation",
166
  FinalReviewManager = "final_review_manager",
167
  FinalReviewHr = "final_review_hr",
168
  PendingApproval = "pending_approval",
169
  Approved = "approved",
170
  Ready = "ready",
171
  Live = "live",
172
  Assessment = "assessment",
173
  Completed = "completed",
174
}
175
176
export enum ResponseScreeningBuckets {
177
  Consideration = "consideration",
178
  ReadyToAllocate = "ready_to_allocate",
179
  Allocated = "allocated",
180
  Unavailable = "unavailable",
181
  DoesNotQualify = "does_not_qualify",
182
}
183
184
export const CitizenshipId = {
185
  citizen: 1,
186
  permanentResident: 2,
187
  workPermitOpen: 3,
188
  workPermitClosed: 4,
189
  notEntitled: 5,
190
};
191
192
export const VeteranId = {
193
  none: 1,
194
  current: 2,
195
  past: 3,
196
};
197
198
export const ApplicationStatusId = {
199
  draft: 1,
200
  submitted: 2,
201
  requiresAction: 3,
202
  underReview: 4,
203
  rejected: 5,
204
};
205
206
export const ApplicationStepId = {
207
  basic: 1,
208
  experience: 2,
209
  skills: 3,
210
  fit: 4,
211
  review: 5,
212
  submission: 6,
213
};
214
215
export type ApplicationStep =
216
  | "basic"
217
  | "experience"
218
  | "skills"
219
  | "fit"
220
  | "review"
221
  | "submission";
222
223
export type ProgressBarStatus = "default" | "complete" | "error" | "current";
224
225
export function getKeyByValue(object, value): string {
226
  return (
227
    Object.keys(object).find((key) => object[key] === value) ?? "key not found."
228
  );
229
}
230
231
export function enumToIds(enumType: object): number[] {
232
  const enumVals = Object.values(enumType);
233
  // Note: this first array includes the list of ids as strings, followed by the list of names as strings
234
  const enumIds = enumVals.filter((item) => !Number.isNaN(Number(item)));
235
  return enumIds.map((id) => Number(id));
236
}
237
238
export const SkillLevelIdValues = enumToIds(SkillLevelId);
239
240
export const SkillTypeIdValues = enumToIds(SkillTypeId);
241
242
export const AssessmentTypeIdValues = enumToIds(AssessmentTypeId);
243
244
export const CriteriaTypeIdValues = enumToIds(CriteriaTypeId);
245